from flask import Flask, request, render_template, redirect, url_for, session, flash, jsonify
from flask import Flask
from models import User, Blog, Column
from exts import db
import config
from werkzeug.utils import secure_filename
from flask import send_from_directory
import os,time,json
from admin import admin
from index import index


app = Flask(__name__)
app.config.from_object(config)
db.init_app(app)

#文件路径
UPLOAD_FOLDER = '/static/uploads'

# 允许上传文件类型
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])

#上传文件大小
MAX_CONTENT_LENGTH = 16 * 1024 * 1024  # 16MB

# 网站首页
app.register_blueprint(index)

# 网站后台
app.register_blueprint(admin,url_prefix='/admin')

app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'

if __name__ == '__main__':
    app.jinja_env.variable_start_string = '{{ '
    app.jinja_env.variable_end_string = ' }}'
    app.debug = True
    app.run(host="0.0.0.0", port=5001)
